li = [1, 2, 3]
print(li.__sizeof__())
print(type(li))

tup = (1, 2, 3)
print(tup.__sizeof__())
print(type(tup))

# 字典与集合
d1 = {'name': 'jason', 'age': 20, 'gender': 'male'}
d2 = dict({'name': 'jason', 'age': 20, 'gender': 'male'})
d3 = dict([('name', 'jason'), ('age', 20), ('gender', 'male')])
d4 = dict(name='jason', age=20, gender='male')
print(d1 == d2 == d3 == d4)

s1 = {1, 2, 3}
s2 = set([1, 2, 3])
print(s1 == s2)

d = {'name': 'jason', 'age': 20}
print(d['name'])
# print(d['location'])
print(d.get("name"))
print(d.get("location", "null"))


def find_product_price(products, product_id):
    for id, price in products:
        if id == product_id:
            return price
    return None


products = [
    (143121312, 100),
    (432314553, 30),
    (32421912367, 150)
]

print('The price of product 432314553 is {}'.format(find_product_price(products, 432314553)))

products = {
    143121312: 100,
    432314553: 30,
    32421912367: 150
}
print('The price of product 432314553 is {}'.format(products[432314553]))
data = "哈哈哈，这是谁呀，sss";
print("String format data:{},size:{}".format(data, len(data)))
